<template>
  <div class="dropdownButton">
    <!-- <el-button
      v-for="(btn, num) in buttons"
      :key="num"
      :type="btn.handleGetType ? btn.handleGetType(initData) : btn.type"
      :size="btn.size"
      :plain="btn.plain"
      @click="btn.handelClick(initData)"
      >{{
        btn.handleGetName ? btn.handleGetName(initData) : btn.label
      }}</el-button
    >-->
    <!-- {{logdata(initData)}} -->

    <el-dropdown @command="handleCommand">
      <span class="el-dropdown-link">
        {{ label }}
        <i class="el-icon-arrow-down el-icon--right"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item
          v-for="(btn, index) in buttons"
          :key="index"
          :command="btn"
          >{{
            btn.handleGetName ? btn.handleGetName(initData) : btn.label
          }}</el-dropdown-item
        >
        <!-- <el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
        <el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
        <el-dropdown-item icon="el-icon-circle-plus-outline">螺蛳粉</el-dropdown-item>
        <el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
        <el-dropdown-item icon="el-icon-circle-check">蚵仔煎</el-dropdown-item>-->
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>
<script>
export default {
  name: "znxdDropdownButton",
  data () {
    return {}
  },
  props: {
    /* button object
    {
      label: "停用",
        handleGetName: (row) => {
          return row.jobState === 1 ? "停用" : "启用";
        },
          handelClick: (row) => {
            this.changeStatusEvent(
              row,
              "jobState",
              row.jobState === 1 ? 0 : 1
            );
          }
    }
    */
    buttons: Array,
    initData: Object,
    label: String
  },
  methods: {
    handleCommand (btn) {
      btn.handelClick(this.initData)
    }
  },
  mounted () {
    // console.log("buttonList", this.initData);
  }
};
</script>
<style lang="scss" scoped>
.dropdownButton {
  .el-dropdown {
    .el-dropdown-link {
      color: #1890ff;
    }
  }
}
</style>
